package com.example.qxfw.shfx.Mapper;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.qxfw.common.entity.qx.AreaRain;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.sql.Timestamp;
import java.util.List;

@Mapper
@DS("service")
public interface AreaRainMapper extends BaseMapper<AreaRain> {

    @Select("SELECT area_rain.areaname, area_rain.rain, county_point.lat, county_point.lon " +
            "FROM area_rain " +
            "JOIN county_point ON area_rain.areaname = county_point.name " +
            "WHERE observtime = #{startDateTime} " +
            "AND areatype = #{areaType} ;")
    List<AreaRain> queryDataShow(Timestamp startDateTime, Integer ntimes, Short areaType);

    @Select("SELECT area_rain.areaname, area_rain.rain, county_point.lat, county_point.lon " +
            "FROM area_rain " +
            "JOIN county_point ON area_rain.areaname = county_point.name " +
            "WHERE observtime BETWEEN #{startDateTime} AND #{endDateTime} " +
            "AND areatype = #{areaType} ;")
    List<AreaRain> queryDataPeriodShow(Timestamp startDateTime, Timestamp endDateTime, Integer ntimes, Short areaType);
}
